<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<c-rt:if test="${!empty param.id}">
<c-rt:set var="workFlowNode" value="${pu:get('com.yaodian100.crm.workflow.entity.WorkFlowNode', param.id)}"/>
</c-rt:if>
${pu:reqSet('groups', pu:queryByHql('from TaskGroup order by id asc', null, null)) }
<h1>
<c-rt:if test="${empty workFlowNode}">
<c-rt:set var="workFlowName" value="${param.workFlowName}"/>
<c-rt:set var="parentId" value="${param.parentId}"/>
新增
</c-rt:if>
<c-rt:if test="${!empty workFlowNode}">
<c-rt:set var="workFlowName" value="${workFlowNode.workFlow.name}"/>
<c-rt:set var="parentId" value="${workFlowNode.parent.id}"/>
修改
</c-rt:if>
节点</h1>
<script>
$(document).ready(function(){
	$('#submit_button').click(function(){
		var form;
		<c-rt:set var="focused" value="${parentId}"/>
		<c-rt:if test="${empty parentId}">
			<c-rt:set var="focused" value="${workFlowName}"/>
		</c-rt:if>
		doAR('<%=application.getContextPath() %>/workFlow/update.do', 'rightSide', 'theForm', function(){
			doAR('<%=application.getContextPath() %>/workFlow/page.do?iamlazy=leftSide&focused=${focused}','leftSide', form)
			}
			);
		});
});
</script>
<c-rt:if test="${param.operation=='saved'}">
已储存异动
</c-rt:if>
<form method="post" id="theForm" name="theForm">
<input type="hidden" name="operation" value="saved"/>
<input type="hidden" name="workFlowName" value="${workFlowName }"/>
<input type="hidden" name="parentId" value="${parentId }"/>
<table class="tb-data" width="100%">
<tr><th width="130px">ID</th><td>${workFlowNode.id}<input type="hidden" name="id" value="${workFlowNode.id }"/></td></tr>
<tr><th width="130px">短描述</th><td><input type="text" name="shortDesc" value="${workFlowNode.shortDesc }"/></td></tr>
<%--
<tr><th width="130px">处理者</th><td><input type="text" name="responserId" value="${workFlowNode.responser }"/></td></tr>
--%>
<tr><th width="130px">处理群组</th><td>

<select name="responseGroup">
	<option value="">请选择</option>
	<c-rt:forEach items="${groups}" var="group">
		<option value="${group.id }" <c-rt:if test="${workFlowNode.responseGroup==group.id }">selected="selected"</c-rt:if>>${group.name }</option>
	</c-rt:forEach>
</select>
</td></tr>
<tr><th width="130px">允许流程往上一层</th><td>
<input type="radio" name="allowBackward" value="true" <c-rt:if test="${empty workFlowNode || workFlowNode.allowBackward=='true' }">checked="checked"</c-rt:if>/>允许
<input type="radio" name="allowBackward" value="false" <c-rt:if test="${workFlowNode.allowBackward=='false' }">checked="checked"</c-rt:if>/>不允许

</td></tr>
<tr><th width="130px">需审核</th><td>
<input type="radio" name="needApprove" value="true" <c-rt:if test="${empty workFlowNode || workFlowNode.needApprove=='true' }">checked="checked"</c-rt:if>/>需要
<input type="radio" name="needApprove" value="false" <c-rt:if test="${workFlowNode.needApprove=='false' }">checked="checked"</c-rt:if>/>不需要

</td></tr>
<tr>
<th width="130px">需被审核群组</th><td>
<select name="beApprovedGroup">
	<option value="">请选择</option>
	<c-rt:forEach items="${groups}" var="group">
		<option value="${group.id }" <c-rt:if test="${workFlowNode.beApprovedGroup==group.id }">selected="selected"</c-rt:if>>${group.name }</option>
	</c-rt:forEach>
</select>
</td>
</tr>
<%--
<tr><th width="130px">审核人</th><td>
<input type="text" name="approver" value="${workFlowNode.approver }"/>

</td></tr>
--%>
<tr><th width="130px">审核群组</th><td>
<select name="approveGroup">
	<option value="">请选择</option>
	<c-rt:forEach items="${groups}" var="group">
		<option value="${group.id }" <c-rt:if test="${workFlowNode.approveGroup==group.id }">selected="selected"</c-rt:if>>${group.name }</option>
	</c-rt:forEach>
</select>

</td></tr>
<%--
<tr><th width="130px">CTI call out</th><td>
<c-rt:set var="callOut" value="false"/>
<c-rt:if test="${!empty workFlowNode.callOut}">
	<c-rt:set var="callOut" value="${workFlowNode.callOut}"/>
</c-rt:if>
<input type="radio" name="callOut" value="true" <c-rt:if test="${callOut ==true}">checked="checked"</c-rt:if>/>是
<input type="radio" name="callOut" value="false" <c-rt:if test="${callOut ==false}">checked="checked"</c-rt:if>/>否


</td></tr>
 --%>
 <tr>
 <th>节点行为</th><td>
 	<c-rt:if test="${!empty workFlowNode}">
 	${pu:listAdd('nodeParas', workFlowNode.id) }
	${pu:reqSet('nodeActs', pu:queryByHql('from WorkFlowNodeAct where node.id=?', pu:arrayGet('nodeParas'), null)) }
 	</c-rt:if>
 	${pu:listAdd('buttonParas', 'Button') }
 	${pu:reqSet('buttons', pu:queryByHql('from Attribute where dataType=?', pu:arrayGet('buttonParas'), null)) }
 	<select name="nodeAct" multiple="multiple" size="10">
 	<c-rt:forEach items="${buttons }" var="bu">
 		<option value="${bu.id }"
 		<c-rt:forEach items="${nodeActs }" var="na">
 			<c-rt:if test="${bu.id==na.attr.id }">selected="selected"</c-rt:if>
 		</c-rt:forEach>
 		>${bu.description }</option>
 	</c-rt:forEach>
 	</select>
 </td>
 </tr>
	<tr>
	<th></th><td><input type="button" id="submit_button" value="送出"/>
	<input type="reset" value="重设"/>
	</td>
	</tr>
	
	</table>
</form>

